<?php
class DataCompanyStationAction extends CommonAction {
    
    protected $_str_model           = 'DataCompanyStation';
    protected $_arr_search          = array(
                                            'company_id'        => array('LIKE', '%?%', 'int'),
                                            'company_name'      => array('LIKE', '%?%', 'str'),
                                            'station_id'        => array('LIKE', '%?%', 'int'),
                                            'station_name'      => array('LIKE', '%?%', 'str'),
                                            'is_position_audit' => array('EQ', '?', 'int'),
                                            'remark'            => array('LIKE', '%?%', 'str'),
                                            'status'            => array('EQ', '?', 'int'),
                                      );
    protected $_str_status_type     = 'all';

    /**
     * Search before
     * 
     * @param  void
     * @return void
     * @author andy
     */
    public function before_search() {

        if ( ! $this->_post('company_id') ) {
            set_post('company_id', D('DataCompanyBasic')->get_pk_by_name($this->_post('company_name'), 'company_name'), false);
        }
    }
    
    /**
     * Before do action
     * for edit, add
     * 
     * @param  void
     * @return void
     * @author andy
     */
    public function before_do_action() {

        set_post('company_id', $this->_post('data_company_basic_company_id'), false);
    }
}